<template>
  <div v-if="Object.keys(detailInfo).length !==0" class="goods-info">
    <div class="info-desc clear-fix">
         <div class="start">

         </div>
      <div class="desc">{{detailInfo.desc}}</div>
      <div class="end"></div>
    </div>

    <div class="info-key">{{detailInfo.detailImage[0].key}}</div>
    <div class="infolist">
      <img v-for="(item,index) in detailInfo.detailImage[0].list"
           :key="index"
           v-lazy="item"
           @load="imload"
           alt="">
    </div>

  </div>
</template>

<script>
  export default {
    name: "DetailGoodsInfo",
    props:{
      detailInfo:{
        type:Object,
        default(){
          return {}
        }
      }

  },
    data(){
      return {
        count:0,
        imagelength:0,
      }
    },
    methods:{
      imload(){
        if(++this.count == this.imagelength) {
          this.$emit('dgiloaded')
        }
      }
    },
    watch:{
      detailInfo(){
        this.imagelength = this.detailInfo.detailImage[0].list.length

      }
    }
  }
</script>

<style scoped>
  .goods-info {
    padding: 15px 0 0 0;
    margin-top: 10px;
    border-top: 4px solid #f6f6f6;
  }
  .info-desc {
    padding: 0 15px;
  }
  .info-desc .start,
  .info-desc .end {
    width: 90px;
    height: 1px;
    background-color: #a3a3a5;
    position: relative;
  }
  .info-desc .start {
    float: left;
  }

  .info-desc .end {
    float: right;
  }

  .info-desc .start::before, .info-desc .end::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: #333;
    bottom: 0;
    border-radius: 50%;
    top: -3px;
  }
  .info-desc .end::after {
    right: 0;
  }
  .desc{
    font-size: 14px;
    padding: 10px 0;
  }

  .info-key{
    font-weight: 600;
    padding-left: 14px;
  }
  .infolist img{
    width: 100%;
  }
</style>
